#region Copyright Jonathan Quiros

//	
// All rights are reserved. Reproduction or transmission in whole or in 
// part, in any form or by any means, electronic, mechanical or otherwise, 
// is prohibited without the prior written consent of the copyright owner.
//
// Filename: Extensions.cs
//

#endregion

using System.Web.Mvc;
using Ids.Utils;

namespace Novagoal.Website.WebApp.Helpers
{
    public enum MessageType
    {
        [Value("SuccessMessage")]
        Success,
        [Value("ErrorMessage")]
        Error,
        [Value("WarningMessage")]
        Warning
    }

    public static class Extensions
    {
        #region CONSTANTS



        #endregion

        #region PROPERTIES

        

        #endregion

        #region PUBLIC METHODS

        public static void SetMessage(this TempDataDictionary tempDataDictionary, string message)
        {
            tempDataDictionary.SetMessage(message, MessageType.Success);
        }

        public static string GetMessage(this TempDataDictionary tempDataDictionary)
        {
            return tempDataDictionary.GetMessage(MessageType.Success);
        }

        public static void SetMessage(this TempDataDictionary tempDataDictionary, string message, MessageType type)
        {
            tempDataDictionary[type.ToStringValue()] = message;
        }

        public static string GetMessage(this TempDataDictionary tempDataDictionary, MessageType type)
        {
            return (tempDataDictionary[type.ToStringValue()] as string) ?? string.Empty;
        }

        #endregion

        #region PRIVATE METHODS



        #endregion
    }
}